package com.zy.controller;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author LittleDesire
 * @description
 * @date 2022-04-08 周五 14:21
 * @since 17
 */
@RestController
public class IndexController {
    @RequestMapping
    public String index() {
        return "你好";
    }

    @RequestMapping("show")
    public String show() {
        int i = 3/0;
        return "你好";
    }

    /**
     * 局部异常处理机制, 本类内的所有异常都会被接管
     * @param e exception
     * @return 错误信息
     */
    //@ExceptionHandler
    public String exceptionHandler(Exception e) {
        return e.getMessage();
    }
}
